﻿using System;
using System.Web.Configuration;

namespace SiteLib.Tools
{
	public class ConfigReader
	{
		private enum Keys
		{
			DefaultCountry,
			Donotreply,
			AdminMail,
			DefaultSmtpServer,
			DefaultSmtpPort,
			DefaultSmtpPassword,
			DefaultSmtpAccount,
			FCKeditorBasePath,
			FCKeditorUserFilesPath,
			TeaserWordsCount,
			SearchTeaserWrapperWordsCount,
			LocationsRowsCount,
			EmailTemplateAttachmentsPath,
			SiteContentAttachmentPath,
            AdminTeaserWordsCount,
            UrlType0,
            UrlType1,
            UrlType2,
            UrlType3
		}
        #region Methods
        public static string DefaultConnectionString
		{
			get { return WebConfigurationManager.ConnectionStrings["cstrHematology"].ConnectionString; }
		}

        private static string GetSettingValue(Keys appSettingsKey)
		{
			return WebConfigurationManager.AppSettings[appSettingsKey.ToString()];
		}

        #endregion

        public static string UrlType0
        {
            get { return GetSettingValue(Keys.UrlType0); }
        }

        public static string UrlType1
        {
            get { return GetSettingValue(Keys.UrlType1); }
        }

        public static string UrlType2
        {
            get { return GetSettingValue(Keys.UrlType2); }
        }

        public static string UrlType3
        {
            get { return GetSettingValue(Keys.UrlType3); }
        }

        public static string EmailTemplateAttachmentsPath
		{
			get { return GetSettingValue(Keys.EmailTemplateAttachmentsPath); }
		}

		public static string SiteContentAttachmentPath
		{
			get { return GetSettingValue(Keys.SiteContentAttachmentPath); }
		}

		public static string DefaultCountry
		{
			get { return GetSettingValue(Keys.DefaultCountry); }
		}

		public static string AdminMail
		{
			get { return GetSettingValue(Keys.AdminMail); }
		}

		public static string DonotreplyMail
		{
			get { return GetSettingValue(Keys.Donotreply); }
		}

		public static string DefaultSmtpServer
		{
			get { return GetSettingValue(Keys.DefaultSmtpServer); }
		}

		public static int DefaultSmtpPort
		{
			get { return Convert.ToInt32(GetSettingValue(Keys.DefaultSmtpPort)); }
		}

		public static string DefaultSmtpPassword
		{
			get { return GetSettingValue(Keys.DefaultSmtpPassword); }
		}

		public static string FCKeditorBasePath
		{
			get { return GetSettingValue(Keys.FCKeditorBasePath); }
		}

		public static string FCKeditorUserFilesPath
		{
			get { return GetSettingValue(Keys.FCKeditorUserFilesPath); }
		}

		public static string DefaultSmtpAccount
		{
			get { return GetSettingValue(Keys.DefaultSmtpAccount); }
		}

		public static int TeaserWordsCount
		{
			get { return Convert.ToInt32(GetSettingValue(Keys.TeaserWordsCount)); }
		}

		public static int SearchTeaserWrapperWordsCount
		{
			get { return Convert.ToInt32(GetSettingValue(Keys.SearchTeaserWrapperWordsCount)); }
		}

        public static int AdminTeaserWordsCount
        {
            get { return Convert.ToInt32(GetSettingValue(Keys.AdminTeaserWordsCount)); }
        }

		public static int LocationsRowsCount
		{
			get { return Convert.ToInt32(GetSettingValue(Keys.LocationsRowsCount)); }
		}
	}
}
